<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <title>${requestScope.course.cname}签到信息|河海大学实践课程考勤系统</title>
    <jsp:include page="head.jsp"/>
</head>
<body>
<div class="container">
    <jsp:include page="header.jsp"/>
    <div class="row">
        <div class="col-sm-offset-1 col-sm-2">
            <ul class="nav nav-pills nav-stacked">
                <li><a href="${pageContext.request.contextPath}/teacher/index">主页</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/info">个人信息</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/addcourse">添加课程</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/logout">退出登录</a></li>
            </ul>
        </div>
        <div class="col-sm-8">
            <p><a class="btn btn-info btn-sm"
                  href="${pageContext.request.contextPath}/teacher/course?cid=${requestScope.course.cid}">返回课程</a>
                <button class="btn btn-info btn-sm" onclick="location.reload()">刷新页面</button>
            </p>
            <h3>${requestScope.course.cname}：签到信息查询</h3>
            <form class="form">
                <input type="hidden" name="cid" value="${requestScope.course.cid}">
                <div class="row">
                    <div class="col-xs-4 col-md-2">
                        <div class="form-group">
                            <label class="sr-only" for="tnum">任务编号</label>
                            <input id="tnum" class="form-control" type="number" name="tnum" placeholder="任务编号"
                                   maxlength="19" value="${pageContext.request.getParameter("tnum")}">
                        </div>
                    </div>
                    <div class="col-xs-8 col-md-4">
                        <div class="form-group">
                            <label class="sr-only" for="tname">任务名称</label>
                            <input id="tname" class="form-control" type="text" name="tname" placeholder="任务名称"
                                   maxlength="16" value="${pageContext.request.getParameter("tname")}">
                        </div>
                    </div>
                    <div class="col-xs-5 col-md-2">
                        <div class="form-group">
                            <label class="sr-only" for="sid">学生学号</label>
                            <input id="sid" class="form-control" type="text" name="sid" placeholder="学生学号"
                                   maxlength="10" value="${pageContext.request.getParameter("sid")}">
                        </div>
                    </div>
                    <div class="col-xs-5 col-md-2">
                        <div class="form-group">
                            <label class="sr-only" for="sname">学生姓名</label>
                            <input id="sname" class="form-control" type="text" name="sname" placeholder="学生姓名"
                                   maxlength="8" value="${pageContext.request.getParameter("sname")}">
                        </div>
                    </div>
                    <div class="form-group">
                        <input class="btn btn-default" type="submit" value="查询">
                    </div>
                </div>
            </form>
            <p id="msg" class="text-danger text-center">${requestScope.msg}</p>
            <table class="table">
                <thead>
                <tr>
                    <th>任务编号</th>
                    <th>任务名称</th>
                    <th>学生学号</th>
                    <th>学生姓名</th>
                    <th>签到时间</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${requestScope.attendances}" var="attendance">
                    <tr>
                        <td>
                            <a href="${pageContext.request.contextPath}/teacher/query?cid=${requestScope.course.cid}&tnum=${attendance.tnum}"> ${attendance.tnum}</a>
                        </td>
                        <td>${attendance.tname}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/teacher/query?cid=${requestScope.course.cid}&sid=${attendance.sid}">${attendance.sid}</a>
                        </td>
                        <td>${attendance.sname}</td>
                        <td ${attendance.sign_in_time==null?"class=\"text-danger\"":""}>${attendance.sign_in_time==null?"未签到":attendance.sign_in_time.toString().substring(0,19)}</td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
    <jsp:include page="footer.jsp"/>
</div>
</body>
</html>
